<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author markos
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */


/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author markos
 */
class Application_Model_Usuario extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(50)
     *
     * @var string
     */
    protected $_Username;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_Nombre;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_Apellido;

    /**
     * Database var type varchar(1024)
     *
     * @var string
     */
    protected $_Passw;

    /**
     * Database var type char(1)
     *
     * @var string
     */
    protected $_Estado;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_Email;



    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'username'=>'Username',
            'nombre'=>'Nombre',
            'apellido'=>'Apellido',
            'passw'=>'Passw',
            'estado'=>'Estado',
            'email'=>'Email',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column username
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setUsername($data)
    {
        $this->_Username = $data;
        return $this;
    }

    /**
     * Gets column username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->_Username;
    }

    /**
     * Sets column nombre
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setNombre($data)
    {
        $this->_Nombre = $data;
        return $this;
    }

    /**
     * Gets column nombre
     *
     * @return string
     */
    public function getNombre()
    {
        return $this->_Nombre;
    }

    /**
     * Sets column apellido
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setApellido($data)
    {
        $this->_Apellido = $data;
        return $this;
    }

    /**
     * Gets column apellido
     *
     * @return string
     */
    public function getApellido()
    {
        return $this->_Apellido;
    }

    /**
     * Sets column passw
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setPassw($data)
    {
        $this->_Passw = $data;
        return $this;
    }

    /**
     * Gets column passw
     *
     * @return string
     */
    public function getPassw()
    {
        return $this->_Passw;
    }

    /**
     * Sets column estado
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setEstado($data)
    {
        $this->_Estado = $data;
        return $this;
    }

    /**
     * Gets column estado
     *
     * @return string
     */
    public function getEstado()
    {
        return $this->_Estado;
    }

    /**
     * Sets column email
     *
     * @param string $data
     * @return Application_Model_Usuario
     */
    public function setEmail($data)
    {
        $this->_Email = $data;
        return $this;
    }

    /**
     * Gets column email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->_Email;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Usuario
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Usuario());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Usuario::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getUsername() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('username = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getUsername()));
    }
}
